﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using FacebookApp;

public partial class Modules_ucAdvertise : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GetHtmlContentUl();
        }
    }
    private void GetHtmlContentUl()
    {
        string htmlUl_1 = "";
        string htmlUl_2 = "";
        string sqlWhere = "Status = 'True'";
        //string _detail = "";
        List<Ebook> ebook = EbookService.Ebook_GetByTop("10", sqlWhere, "[CreateDate] DESC");
        if (ebook != null)
        {
            foreach (Ebook e in ebook)
            {

                //if (e.Detail.ToString().Length > 200)
                //{
                //    WebMsgBox.Show("12313");
                //    _detail = e.Detail.ToString().Substring(0, 199);
                //}
                //else
                //{
                //    WebMsgBox.Show("NONE");
                //    _detail = e.Detail.ToString();
                //}

                htmlUl_1 += " <li>";
                htmlUl_1 += " <img src=\"" + e.Image.ToString().Replace("~", "") + "\"  width =\"100%\" height =\"200\" title=\"Ebook " + e.Id.ToString() + "\" >";
                htmlUl_1 += " <div class=\"slider-description\">";
                htmlUl_1 += " <div class=\"slider-meta\"><a target=\"_parent\" title=\"Ebook 1\" href=\"#Category-" + e.Id.ToString() + "\">/ " + e.Name.ToString() + " /</a> <i>" + "" + "</i></div>";//e.YearPub.ToString()
                htmlUl_1 += " <h4>Mô tả thông tin</h4>";
                htmlUl_1 += " <p>" + e.Promotion.ToString();
                htmlUl_1 += " <a class=\"readmore\" href=\"/Pages/ProductDetail.aspx?Catogory_Id =" + e.Category_Id + "&Id=" + e.Id + "\">Read more </a>";
                htmlUl_1 += " </p>";
                htmlUl_1 += " </div>";
                htmlUl_1 += " </li> ";
                htmlUl_2 += " <li>";
                htmlUl_2 += " <div>";
                htmlUl_2 += " <img src=\"" + e.Image.ToString().Replace("~", "") + "\" />";
                htmlUl_2 += " <h3> " + e.Name.ToString() + " </h3>";
                htmlUl_2 += " <span>" + "" + "</span> - " + e.Promotion.ToString();//e.YearPub.ToString()
                htmlUl_2 += " </div>    ";
                htmlUl_2 += " </li>";
            }
        }
        contentUl_1.InnerHtml = htmlUl_1;
        contentUl_2.InnerHtml = htmlUl_2;

    }
}